home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / video / scrollmon / CredSection.c++ < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.4 KB  |  85 lines

  1. /*
  2.  * Copyright (C) 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. #include "CredSection.h"
  18.  
  19.   void CredSection::setLMargin(int lmargin)
  20.     {
  21.       lMargin = lmargin;
  22.     }
  23.  
  24.   void CredSection::setRMargin(int rmargin)
  25.     {
  26.       rMargin = rmargin;
  27.     }
  28.  
  29.  
  30.   CredImage::CredImage(int xoffset, int yoffset, int xsize, int ysize, 
  31.                        ulong *buf)
  32.     {
  33.       credCnt = 0;
  34.       size = ysize;
  35.       spacing = 1;
  36.       xoff = xoffset;
  37.       yoff = yoffset;
  38.       totalCredHeight += size + yoff;    
  39.       image[credCnt].xpos = 0;
  40.       image[credCnt].width = xsize;
  41.       image[credCnt].height = ysize;      
  42.       image[credCnt].imgBuf = buf;      
  43.     }
  44.  
  45.   CredFont::CredFont(char *fFamily, int fsize, long fcolor, 
  46.                             char *fjust, float fangle, float fspacing) 
  47.     {
  48.       fontFamily = new char[strlen(fFamily) + 1];
  49.       strncpy(fontFamily, fFamily, strlen(fFamily) + 1);
  50.       fontJust = new char[strlen(fjust) + 1];
  51.       strncpy(fontJust, fjust, strlen(fjust) + 1);
  52.       fontColor = fcolor;
  53.       size = fsize;
  54.       fontAngle = fangle;
  55.       spacing = fspacing;
  56.       credCnt = 0;
  57.       fontID = credSectCnt;
  58.       xoff = 0;
  59.       yoff = 0;
  60.     } 
  61.   
  62.   void CredFont::addStr(char *str)
  63.     {
  64.       credStr[credCnt] = new char[strlen(str) + 1];
  65.       strncpy(credStr[credCnt], str, strlen(str) + 1);
  66.       credCnt++;
  67.       totalCredHeight += (ulong)(size * spacing);    
  68.     }
  69.  
  70.   char *CredFont::getStr(int cur)
  71.     {
  72.       return( credStr[cur] );
  73.     }
  74.  
  75.   void CredFont::loadFontEnv()
  76.     {
  77.       wfm_makefontmat(mat, fontAngle, size);
  78.       wfm_makefont(fontID, fontFamily, mat, 0, 0);
  79.       wfm_font(fontID);
  80.       wfm_getfontinfo(fontID, &finfo);
  81.     }
  82.   
  83. int CredSection::credSectCnt = 0;
  84. ulong CredSection::totalCredHeight = 0;
  85.